package com.chuanke.ckfamily.service.social.thread;

import com.chuanke.ckfamily.dao.social.model.Family;
import com.chuanke.ckfamily.service.common.SysConfigService;
import com.chuanke.ckfamily.service.social.FamilyMemberService;
import com.chuanke.ckfamily.service.social.FamilyService;

import org.springframework.jdbc.datasource.DataSourceTransactionManager;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class LoadFansToFamilyThread {

    private static ThreadPoolExecutor threadPool = new ThreadPoolExecutor(100, 1000, 3,
                                        TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(500),
				new ThreadPoolExecutor.DiscardOldestPolicy());

    public static void load(Long uid, Family family, boolean auto, FamilyService familyService, FamilyMemberService familyMemberService, SysConfigService sysConfigService) {
        LoadFansToFamilyRunable thread = new LoadFansToFamilyRunable(uid, family, auto, familyService, familyMemberService,sysConfigService);
        threadPool.execute(thread);
    }
}
